import { serviceCAD } from './axios.js';

// 用户登陆login
export function login(data) {
  return serviceCAD({
    url: 'user/doLogin',
    method: 'post',
    data,
  });
}

// 保存CAD图
export function saveCAD(data) {
  return serviceCAD({
    url: 'cad',
    method: 'post',
    data,
  });
}

// 删除CAD图
export function deleteCADById(id) {
  return serviceCAD({
    url: `cad?id=${id}`,
    method: 'delete'
  });
}

// 更新CAD图
export function updateCAD(data) {
  return serviceCAD({
    url: `cad`,
    method: 'put',
    data,
  });
}

// 根据CADid获取空间节点
export function getSpaceById(id) {
  return serviceCAD({
    url: `cad/space/getByCad?cadId=${id}`,
    method: 'get',
  });
}

// 保存空间节点
export function saveSpace(data) {
  return serviceCAD({
    url: 'cad/space',
    method: 'post',
    data,
  });
}

// 更新空间节点
export function updateSpace(data) {
  return serviceCAD({
    url: `cad/space`,
    method: 'put',
    data,
  });
}

// 删除空间节点
export function deleteSpaceById(id) {
  return serviceCAD({
    url: `cad/space?spaceId=${id}`,
    method: 'delete',
  });
}

// 生成二维码接口
export function createQRcode(id) {
  return serviceCAD({
    url: `cad/space/code?spaceId=${id}`,
    method: 'post',
    responseType: 'blob',
  });
}

// 扫描二维码后展示数据
export function getSpaceDataByQRcode(id) {
  return serviceCAD({
    url: `cad/space/query?spaceId=${id}`,
    method: 'get',
  });
}

// 添加数据
export function createAddData(data) {
  return serviceCAD({
    url: `cad/addData`,
    method: 'post',
    data
  });
}

// 根据CADID查询数据
export function getDataByCADId(id, type) {
  return serviceCAD({
    url: `cad/queryData?cadId=${id}&type=${type}`,
    method: 'get',
  });
}

// 删除数据接口
export function deleteData(data) {
  return serviceCAD({
    url: `cad/data`,
    method: 'delete',
    data
  });
}

// 绑定数据
export function linkData(data) {
  return serviceCAD({
    url: `cad/space/linkData`,
    method: 'post',
    data
  });
}

// cad绑定备忘录
export function createBindMome(data) {
  return serviceCAD({
    url: `cad/space/mome`,
    method: 'post',
    data
  });
}

// cad查询备忘录
export function getMome(id) {
  return serviceCAD({
    url: `cad/space/mome?spaceId=${id}`,
    method: 'get'
  });
}

// 全景视图绑定备忘录
export function createBindMomeInPanorama(data) {
  return serviceCAD({
    url: `cad/panorama/mome`,
    method: 'post',
    data
  });
}

// 全景视图查询备忘录
export function getMomeInPanorama(id) {
  return serviceCAD({
    url: `cad/panorama//mome?panoramaId=${id}`,
    method: 'get'
  });
}

// 查询数据平台目录
export function getDataTree() {
  return serviceCAD({
    url: `cad/data/getDataTree`,
    method: 'get'
  });
}

// 根据树目录id查询下层目录
export function getDataTreeById(id) {
  return serviceCAD({
    url: `cad/data/getTreeByParentId?parentId=${id}`,
    method: 'get'
  });
}

// 查询数据点位实时数据
export function getRealDataPoint(data) {
  return serviceCAD({
    url: `cad/data/getData`,
    method: 'post',
    data
  });
}

// 添加全景图
export function savePanorama(data) {
  return serviceCAD({
    url: `cad/panorama`,
    method: 'post',
    data,
    headers: { "Content-Type": "multipart/form-data" }
  });
}

// 删除全景图
export function deletePanorama(id) {
  return serviceCAD({
    url: `cad/panorama?id=${id}`,
    method: 'delete',
  });
}

// 根据空间id获取全景图
export function getPanoramaByCadId(id) {
  return serviceCAD({
    url: `cad/panorama/getByCadId?cadId=${id}`,
    method: 'get'
  });
}

// 在全景图中添加数据、文本、图片接口
export function postPanoramaAddmaker(data) {
  return serviceCAD({
    url: `cad/panorama/addMaker`,
    method: 'post',
    data
  });
}

// 查询全景图中的摄像机
export function getPanoramaAddVideo(treeId,panoramaId) {
  return serviceCAD({
    url: `cad/camera/byCadTreeIdAndPanoramaId?cadTreeId=${treeId}&panoramaId=${panoramaId}`,
    method: 'get'
  });
}

// 在全景图中添加摄像机视频
export function postPanoramaAddVideo(data) {
  return serviceCAD({
    url: `cad/camera`,
    method: 'post',
    data
  });
}

// 删除摄像机
export function deletePanoramaVideo(id) {
  return serviceCAD({
    url: `cad/camera?id=${id}`,
    method: 'delete',
  });
}

// 根据全景图ID查询数据、文本、图片
export function getPanoramaDataBySpaceId(data) {
  return serviceCAD({
    url: `cad/panorama/queryMaker`,
    method: 'post',
    data
  });
}

// 在全景图中删除数据、文本、图片接口
export function deletePanoramaData(id) {
  return serviceCAD({
    url: `cad/panorama/deleteMaker?id=${id}`,
    method: 'delete',
  });
}

// 保存右侧菜单树⽬录
export function createRightTree(data) {
  return serviceCAD({
    url: `cad/cadTree`,
    method: 'post',
    data,
    headers: { "Content-Type": "multipart/form-data" }
  });
}

// 更新右侧菜单树目录
export function updateRightTree(data) {
  return serviceCAD({
    url: `cad/cadTree`,
    method: 'put',
    data,
  });
}


// 删除右侧菜单树目录
export function deleteRightTree(id) {
  return serviceCAD({
    url: `cad/cadTree?id=${id}`,
    method: 'delete',
  });
}

// 查询右侧菜单树目录
export function getRightTree() {
  return serviceCAD({
    url: `cad/cadTree`,
    method: 'get',
  });
}

// 添加和修改看板接⼝
export function createDisplay(data) {
  return serviceCAD({
    url: `cad/display`,
    method: 'post',
    data
  });
}

// 根据树⽬录ID查询看板接⼝
export function getDisplayByCadTree(id) {
  return serviceCAD({
    url: `cad/display/getByCadTreeId?cadTreeId=${id}`,
    method: 'get'
  });
}

// 删除看板接⼝
export function deleteDisplay(id) {
  return serviceCAD({
    url: `cad/display?id=${id}`,
    method: 'delete',
  });
}

export function threeDBindData(data) {
  return serviceCAD({
    url: `cad/threeD/bindData`,
    method: 'post',
    data
  });
}

export function threeDQueryBindData(cadTreeId) {
  return serviceCAD({
    url: `cad/threeD/queryBindData?cadTreeId=${cadTreeId}`,
    method: 'get',
  });
}


export function deleteThreeDQueryBindData(id) {
  return serviceCAD({
    url: `cad/threeD/bindData?id=${id}`,
    method: 'delete',
  });
}

export function deviceTemplate(data) {
  return serviceCAD({
    url: `cad/deviceTemplate`,
    method: 'post',
    data
  });
}

export function selectDeviceTemplate(cadTreeId) {
  return serviceCAD({
    url: `cad/deviceTemplate?cadTreeId=${cadTreeId}`,
    method: 'get',
  });
}

export function deletedeviceTemplate(id) {
  return serviceCAD({
    url: `cad/deviceTemplate?id=${id}`,
    method: 'delete',
  });
}

// 生成二维码
export function createThreeDQRCode(data) {
  return serviceCAD({
    url: `cad/threeD/code`,
    method: 'post',
    data,
    responseType: 'blob',
  });
}

// 保存界面按钮连接
export function savePageLink(data) {
  return serviceCAD({
    url: `cad/navigation/pageLink`,
    method: 'post',
    data,
  });
}

// 查询界面按钮连接
export function selectPageLink(cadTreeId) {
  return serviceCAD({
    url: `cad/navigation/getByCadTreeId?cadTreeId=${cadTreeId}`,
    method: 'get',
  });
}

// 删除界面按钮连接
export function delPageLink(id) {
  return serviceCAD({
    url: `cad/navigation/pageLink?id=${id}`,
    method: 'delete',
  });
}

// 保存或修改图片
export function postDisplayImage(data) {
  return serviceCAD({
    url: `cad/display/image`,
    method: 'post',
    data,
  });
}

// 删除图片
export function delDisplayImage(id) {
  return serviceCAD({
    url: `cad/display/image?id=${id}`,
    method: 'delete',
  });
}

// 根据cadTreeId获取图片
export function getDisplayImages(cadTreeId) {
  return serviceCAD({
    url: `cad/display/images?cadTreeId=${cadTreeId}`,
    method: 'get',
  });
}

// 根据cadTreeId查询所有的看板数据
export function getDisplayData(cadTreeId) {
  return serviceCAD({
    url: `cad/navigation/data/byCadTreeId?cadTreeId=${cadTreeId}`,
    method: 'get',
  });
}

// 保存看板数据
export function postDisplayData(data) {
  return serviceCAD({
    url: `cad/navigation/data`,
    method: 'post',
    data,
  });
}

// 删除看板数据
export function delDisplayData(id) {
  return serviceCAD({
    url: `cad/navigation/data?id=${id}`,
    method: 'delete',
  });
}

// 根据cadTreeId查询所有的文本数据
export function getDisplayText(cadTreeId) {
  return serviceCAD({
    url: `cad/navigation/text/byCadTreeId?cadTreeId=${cadTreeId}`,
    method: 'get',
  });
}

// 保存看板文本
export function postDisplayText(data) {
  return serviceCAD({
    url: `cad/navigation/text`,
    method: 'post',
    data,
  });
}

// 删除看板文本
export function delDisplayText(id) {
  return serviceCAD({
    url: `cad/navigation/text?id=${id}`,
    method: 'delete',
  });
}
